<?php
	
	// Add RSS links to <head> section
	automatic_feed_links();
	
	// Load jQuery
	if ( !is_admin() ) {
	   wp_deregister_script('jquery');
        wp_register_script('jquery', get_template_directory_uri() . '/js/jquery.js', false);
        wp_enqueue_script('jquery');
        wp_register_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), false, false );
        wp_enqueue_script( 'bootstrap' );
        wp_register_script( 'functions', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), false, false );
        wp_enqueue_script( 'functions' );
	}
	
	// Clean up the <head>
	function removeHeadLinks() {
    	remove_action('wp_head', 'rsd_link');
    	remove_action('wp_head', 'wlwmanifest_link');
    }
    add_action('init', 'removeHeadLinks');
    remove_action('wp_head', 'wp_generator');
    
	// Declare sidebar widget zone
    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    		'name' => 'Sidebar Widgets',
    		'id'   => 'sidebar-widgets',
    		'description'   => 'These are widgets for the sidebar.',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</div>',
    		'before_title'  => '<h2>',
    		'after_title'   => '</h2>'
    	));
    }

    // Khai bao menu main 
    if(function_exists('register_nav_menus')){
        register_nav_menus(
            array(
                'main_nav' => 'Main Navigation Menu '
            )
        );
    }

    // khai bao shortcode cho sidebar
    add_filter('widget_text', 'do_shortcode');

    // khai bao tien te viet nam
    add_filter( 'woocommerce_currencies', 'add_my_currency' );
 
    function add_my_currency( $currencies ) {
        $currencies['Đồng'] = __( 'Viet Nam Dong', 'woocommerce' );
        return $currencies;
    }
 
    add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
 
    function add_my_currency_symbol( $currency_symbol, $currency ) {
        switch( $currency ) {
            case 'Đồng': $currency_symbol = ' VNĐ'; break;
        }
        return $currency_symbol;
    }

    //thay doi ten button woocommerce
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text' );    // 2.1 +
 
    function woo_archive_custom_cart_button_text() {
 
        return __( 'Mua Hàng', 'woocommerce' );
 
    }
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); 
    function woo_custom_cart_button_text() {
        return __( 'Mua Hàng', 'woocommerce' );
    }



?>